import { createBrowserRouter, Navigate } from 'react-router-dom';

import App from '@/App';
import Login from '@/views/Login';
import ErrorPage from '@/views/error-page';

import Workbench from '../WorkBench'; // 工作台
import MyWorkbench from '../WorkBench/pages/myWorkbench'; //  我的工作台
import StockCheck from '../WorkBench/pages/StockCheck'; // 库存查询
import Sales from '../Sales'; // 销售管理基座
import SalesOrder from '../Sales/pages/salesOrder'; // 销售订单
import CategoryDetails from '../Sales/pages/categoryDetails'; // 品类明细
import CustomerDetails from '../Sales/pages/customerDetails'; // 客户明细
import ProductDetails from '../Sales/pages/productDetails'; // 产品明细
import SalesDetails from '../Sales/pages/salesDetails'; // 销售明细
import SalesLnbound from '../Sales/pages/salesLnbound'; // 销售入库
import SalesOutbound from '../Sales/pages/salesOutbound'; // 销售出库
import SalesReturnOrder from '../Sales/pages/salesReturnOrder'; // 销售退货单

import Warehousing from '../Warehousing'; // 仓储
import DamageReport from '../Warehousing/pages/DamageReport'; // 报损
import Inbound from '../Warehousing/pages/Inbound'; // 入库
import Outbound from '../Warehousing/pages/Outbound'; // 出库
import InitialInventory from '../Warehousing/pages/InitialInventory'; // 初期库存
import InventoryAdjustment from '../Warehousing/pages/InventoryAdjustment'; // 库存调整
import InventoryFlow from '../Warehousing/pages/InventoryFlow'; // 库存流水
import InventoryAlert from '../Warehousing/pages/InventoryAlert'; // 库存预警
import LocationInventoryCount from '../Warehousing/pages/LocationInventoryCount'; // 库位盘点
import LocationQuery from '../Warehousing/pages/LocationQuery'; // 库位查询
import OutboundDetails from '../Warehousing/pages/OutboundDetails'; // 出库明细
import InboundDetails from '../Warehousing/pages/InboundDetails'; // 入库明细
import WarehouseManagement from '../Warehousing/pages/WarehouseManagement'; // 仓库管理




//采购
import Purchase from '../Purchase/index';//采购
import PurchasOrder from '../Purchase/pages/PurchasOrder'; //采购单
import PurchaseReturnRorm from '../Purchase/pages/PurchaseReturnRorm'//采购退货单
import ProcurementAndWarehousing from '../Purchase/pages/ProcurementAndWarehousing'//采购入库
import PurchaseReturnsAndShipments from '../Purchase/pages/PurchaseReturnsAndShipments'//采购退货出库
import ProcurementData from '../Purchase/pages/ProcurementData';//采购数据
import ProductPurchasingStatistics from '../Purchase/pages/ProductPurchasingStatistics';//产品采购统计
import SupplierSupplyStatistics from '../Purchase/pages/SupplierSupplyStatistics';//供应商供应统计
import ProcurementTimelinessStatistics from '../Purchase/pages/ProcurementTimelinessStatistics';//采购时效统计
const routes = [
	{
		path: '/',
		element: <App />,
		errorElement: <ErrorPage />,
		children: [
			{
				// 默认跳转到工作台
				path: '',
				element: <Navigate to="/workbench" />
			},
			// 工作台
			{
				path: 'Workbench',
				element: <Workbench />,
				errorElement: <ErrorPage />,
				children: [
					{
						// 默认跳转到我的工作台
						path: '',
						element: <Navigate to="myWorkbench" />
					},
					{
						// 我的工作台
						path: 'myWorkbench',
						element: <MyWorkbench />,
						errorElement: <ErrorPage />
					},
					{
						// 库存查询
						path: 'stockCheck',
						element: <StockCheck></StockCheck>
					}
				]
			},
			{
				//销售管理
				path: 'Sales',
				element: <Sales />,
				errorElement: <ErrorPage />,
				children: [
					{
						// 默认跳转到销售订单
						path: '',
						element: <Navigate to="SalesOrder" />
					},
					{
						// 销售订单
						path: 'salesOrder',
						element: <SalesOrder />
					},
					{
						// 销售订单详情
						path: 'salesDetails',
						element: <SalesDetails />
					},
					{
						// 销售退货单
						path: 'salesReturnOrder',
						element: <SalesReturnOrder />
					},
					{
						// 销售出库
						path: 'salesOutbound',
						element: <SalesOutbound />
					},
					{
						// 销售入库
						path: 'salesLnbound',
						element: <SalesLnbound />
					},
					{
						// 客户详情
						path: 'customerDetails',
						element: <CustomerDetails />
					},
					{
						// 产品详情
						path: 'productDetails',
						element: <ProductDetails />
					},
					{
						// 品类详情
						path: 'categoryDetails',
						element: <CategoryDetails />
					}
				]
			},
            
			{
				path: 'Warehousing',
				Element: <Warehousing></Warehousing>,
				errorElement: <ErrorPage />,
				children: [
					{
						// 仓库管理
						path: 'WarehouseManagement',
						element: <WarehouseManagement />,
						errorElement: <ErrorPage />
					},
					{
						// 报损
						path: 'DamageReport',
						element: <DamageReport />,
						errorElement: <ErrorPage />
					},
					{
						// 入库
						path: 'Inbound',
						element: <Inbound />,
						errorElement: <ErrorPage />
					},
					{
						// 出库
						path: 'Outbound',
						element: <Outbound />,
						errorElement: <ErrorPage />
					},
					{
						// 初期库存
						path: 'InitialInventory',
						element: <InitialInventory />,
						errorElement: <ErrorPage />
					},
					{
						// 库存调整
						path: 'InventoryAdjustment',
						element: <InventoryAdjustment />,
						errorElement: <ErrorPage />
					},
					{
						// 库存流水
						path: 'InventoryFlow',
						element: <InventoryFlow />,
						errorElement: <ErrorPage />
					},
					{
						// 库存预警
						path: 'InventoryAlert',
						element: <InventoryAlert />,
						errorElement: <ErrorPage />
					},
					{
						// 库位盘点
						path: 'LocationInventoryCount',
						element: <LocationInventoryCount />,
						errorElement: <ErrorPage />
					},
					{
						// 库位查询
						path: 'LocationQuery',
						element: <LocationQuery />,
						errorElement: <ErrorPage />
					},
					{
						// 出库明细
						path: 'OutboundDetails',
						element: <OutboundDetails />,
						errorElement: <ErrorPage />
					},
					{
						// 入库明细
						path: 'InboundDetails',
						element: <InboundDetails />,
						errorElement: <ErrorPage />
					}
			]
			},{
				//采购
				path: 'purchase',
				element: <Purchase />,
				errorElement: <ErrorPage />,
				children: [
					{
						// 采购单
						path: 'purchasorder',
						element: <PurchasOrder />,
					},

					{
						// 采购退货单
						path: 'purchasereturnrorm',
						element: <PurchaseReturnRorm />,
						errorElement: <ErrorPage />
					},
					{
						// 采购入库
						path: 'procurementandwarehousing',
						element: <ProcurementAndWarehousing />,
					},
					{
						// 采购退货出库
						path: 'purchasereturnsandshipments',
						element: <PurchaseReturnsAndShipments />,
					},
					{
						// 采购数据
						path: 'procurementdata',
						element: <ProcurementData />,
					},
					{
						// 产品采购统计
						path: 'productpurchasingstatistics',
						element: <ProductPurchasingStatistics />,
					},
					{
						// 供应商供应统计
						path: 'suppliersupplystatistics',
						element: <SupplierSupplyStatistics />,
					},
					{
						// 采购时效统计
						path: 'procurementtimelinessstatistics',
						element: <ProcurementTimelinessStatistics />,

					}



				]
			}
		]
	},
	{
		// 登录
		path: '/login',
		element: <Login />,
		errorElement: <ErrorPage />
	}
];

export default createBrowserRouter(routes);
